<?php
/***************************************************************
*  Copyright notice
*  (c) 2009, jianyuzhu@gmail.com
*  All rights reserved
*  This script is part of the PPEMI project.
***************************************************************/

//
include_once(CONFIG_PATH . CONFIG_DIR_CLASSES . 'lib.captcha.class.php');
$captcha = new LibCaptcha();
$captcha->width = 120;
$captcha->height = 40;
$captcha->fonts = array(
		//'Antykwa'  => array('spacing' => -3, 'minSize' => 27, 'maxSize' => 30, 'font' => 'AntykwaBold.ttf'),
		//'Candice'  => array('spacing' =>-1.5,'minSize' => 28, 'maxSize' => 31, 'font' => 'Candice.ttf'),
		//'DingDong' => array('spacing' => -2, 'minSize' => 24, 'maxSize' => 30, 'font' => 'Ding-DongDaddyO.ttf'),
		//'Duality'  => array('spacing' => -2, 'minSize' => 30, 'maxSize' => 38, 'font' => 'Duality.ttf'),
		'Heineken' => array('spacing' => -0.5, 'minSize' => 12, 'maxSize' => 20, 'font' => 'Heineken.ttf'),
		//'Jura'     => array('spacing' => -2, 'minSize' => 28, 'maxSize' => 32, 'font' => 'Jura.ttf'),
		//'StayPuft' => array('spacing' =>-1.5,'minSize' => 28, 'maxSize' => 32, 'font' => 'StayPuft.ttf'),
		//'Times'    => array('spacing' => -2, 'minSize' => 12, 'maxSize' => 20, 'font' => 'TimesNewRomanBold.ttf'),
		//'VeraSans' => array('spacing' => -1, 'minSize' => 12, 'maxSize' => 20, 'font' => 'VeraSansBold.ttf'),
			);
$captcha->text = strtoupper(util_create_random_value('4', 'chars'));
$captcha->session_var = 'checkcode';
$captcha->resourcesPath = CONFIG_PATH . "var/captcha/resources";

// OPTIONAL Change configuration...
//$captcha->wordsFile = 'words/es.php';
//$captcha->session_var = 'secretword';
//$captcha->imageFormat = 'png';
//$captcha->scale = 3; $captcha->blur = true;
//$captcha->resourcesPath = "/var/cool-php-captcha/resources";

// OPTIONAL Simple autodetect language example
/*
if (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
    $langs = array('en', 'es');
    $lang  = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
    if (in_array($lang, $langs)) {
        $captcha->wordsFile = "words/$lang.php";
    }
}
*/
// Image generation
$captcha->CreateImage();
//
?>